
#include "ComponentLeaf.h"
#include <iostream>

using namespace npComposite;
using namespace std;


ComponentLeaf::ComponentLeaf() : Component() // class inheritance
{
    //To initialize data member;
}

ComponentLeaf::~ComponentLeaf()
{
    //To delete dynamic data member
    cout << "destroyed************************" << endl;
}

ComponentLeaf::ComponentLeaf(const ComponentLeaf& cpy) : Component(cpy) // class inheritance
{
    //To copy data member
}

ComponentLeaf& ComponentLeaf::operator=(const ComponentLeaf& asn)
{
    if (this == &asn)
    {
        return *this;
    }
    else
    {
        //To invoke base class operator=
        Component::operator=(asn);
        //To assign data member, note to delete dynamic member if exists.
        
        return *this;
    }
}

ComponentLeaf* ComponentLeaf::clone() const
{
    //return new
    return new ComponentLeaf(*this);
}

//other constructors
ComponentLeaf::ComponentLeaf(string name) : Component(name)
{

}

//public methods
void ComponentLeaf::add(Component* component)
{
    cout << "not have a component.." << endl;
}

void ComponentLeaf::remove(Component* component)
{
    cout << "not have a component" << endl;
}

void ComponentLeaf::display(int depth)
{
    for (size_t i = 0; i < depth; i++)
    {
        cout << "-";
    }
    cout << this->getName() << endl;
}

//protected methods

//private methods
